<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>预览派工单</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/bootstraptable/bootstrap-table.css" rel="stylesheet">
</head>
<body>
<div style="color: #0e9aef;margin: 20px;">您正在做的业务是：生产管理--生产调度管理--制定生产派工单</div>

<div class="container" id="preview_div">
     <div style="text-align: right">
         <button type="button" class="btn btn-default" id="preview_btn">预览</button>
         <button type="button" class="btn btn-default" onclick="javascript:history.back()">返回</button>
     </div>
    <div class="panel panel-default" style="margin-top: 5px;">
        <div class="panel-body">
            <form class="form-horizontal" id="preview_dispatch_form">
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">工单制定人：</label>
                        <div class="col-md-8">
                            <input type="text" class="form-control">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">出库单集合：</label>
                        <div class="col-md-8">
                            <input type="text" class="form-control">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">登记人：</label>
                        <div class="col-md-8">
                            <input type="text" class="form-control" id="register">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">登记时间：</label>
                        <div class="col-md-8">
                            <input class="form-control" id="registerTime" readonly style="border: none;background-color: white;">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">产品编号：</label>
                        <div class="col-md-8">
                            <input class="form-control" id="productId" readonly style="border: none;background-color: white;">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">产品名称：</label>
                        <div class="col-md-8">
                            <input class="form-control" id="productName" readonly style="border: none;background-color: white;">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">描述：</label>
                        <div class="col-md-8">
                            <input type="text" class="form-control" id="productDescribe" readonly style="border: none;background-color: white;">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">数量：</label>
                        <div class="col-md-8">
                            <input type="text" id="amount" class="form-control" readonly style="border: none;background-color: white;">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="col-md-4 control-label">备注：</label>
                        <div class="col-md-8">
                            <textarea class="form-control" cols="50" rows="3" id="remark" style="resize: none;">

                            </textarea>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>
<script src="/js/currentTime.js"></script>

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>


<script>
    $(function (){
        let ary = JSON.parse(localStorage.getItem("ary"))
        $.ajax({
            url:"/manufacture/apply/getApply",
            type:"post",
            data:JSON.stringify(ary),
            contentType:"application/json",
            success: function (res) {
                $("#preview_dispatch_form #register").val(res.register)
                $("#preview_dispatch_form #registerTime").val(formater(res.registerTime))
                $("#preview_dispatch_form #productId").val(res.productId)
                $("#preview_dispatch_form #productName").val(res.productName)
                $("#preview_dispatch_form #remark").val(res.remark)
                $("#preview_dispatch_form #amount").val(res.amount)
                $("#preview_dispatch_form #productDescribe").val(res.productDescribe)
            }
        })

        //点击预览按钮时判断是否做了物料/工序/工序物料设计
        $("#preview_btn").click(function (){
            $.post("/manufacture/apply/judgeTheDesign",{"productId": $("#preview_dispatch_form #productId").val()},function (res){
                if (res==false){
                    alert("该产品未制定工序物料设计单")
                    return
                }
                if (res==true){
                    let ary = JSON.parse(localStorage.getItem("ary"))
                   localStorage.setItem("id_ary",JSON.stringify(ary))
                    localStorage.setItem("productId",$("#preview_dispatch_form #productId").val())
                    localStorage.setItem("amount",$("#preview_dispatch_form #amount").val())
                    window.location="production_dispatch_work_orderUI"
                }
            })
        })
    })
</script>
</body>
</html>